﻿Public Class KhachHangDAO
    'Private provider As DataProvider

    'Public Sub New()
    '    provider = New DataProvider()
    'End Sub
    Dim connect As New connect()
    Public Function GetDaTa() As List(Of KhachHangDTO)
        Dim i As Integer
        Dim MaKH, TenKH, CMND, DienThoai, Email, DiaChi, GioiTinh, BiXoa As String
        Dim NgaySinh As DateTime
        Dim KhachHangDTO As KhachHangDTO
        Dim KhachHangList As New List(Of KhachHangDTO)
        Dim dt As New DataTable
        dt = connect.GetData("select * from KHACHHANG")

        For i = 0 To dt.Rows.Count() - 1
            MaKH = dt.Rows(i)("MAKH").ToString()
            TenKH = dt.Rows(i)("HOTEN").ToString()
            NgaySinh = Convert.ToDateTime(dt.Rows(i)("NGAYSINH").ToString())
            CMND = dt.Rows(i)("CMND").ToString()
            GioiTinh = dt.Rows(i)("GIOITINH").ToString()
            DienThoai = dt.Rows(i)("DIENTHOAI").ToString()
            Email = dt.Rows(i)("EMAIL").ToString()
            DiaChi = dt.Rows(i)("DIACHI").ToString()
            BiXoa = dt.Rows(i)("BIXOA").ToString()
            KhachHangDTO = New KhachHangDTO(MaKH, TenKH, NgaySinh, CMND, GioiTinh, DienThoai, Email, DiaChi, BiXoa)
            KhachHangList.Add(KhachHangDTO)

        Next
        Return KhachHangList
    End Function
End Class
